<template>
  <div id="app">

    <router-view/>
  </div>
</template>

<script>
  import {viewUserInfo} from "./api/login";

  export default  {
    created() {
      console.log("我是app组件")
      //请求查看个人信息，如果请求成功证明已经登录了
      viewUserInfo().then(res=>{
        // console.log(res)
        if(res.code==0) {
          this.$store.commit("modifyLoginType",{isLogin:true,userInfo:res.userInfo})
        }
      })
    }
  }
</script>
<style lang="less">
  *{
    padding: 0;
    margin: 0;
  }
  ul,li {
    list-style: none;
  }
  a {
    text-decoration: none;
  }
#app {


}

#nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}

</style>
